home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / pas / swag / tsr.swg / 0027_Tsr's In Turbo Pascal.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-24  |  1KB  |  67 lines

  1. Program TSR;
  2.  
  3. { TSR Demo                      }
  4. { (c) Jul 94 Luis Mezquita Raya }
  5.  
  6. {$M $1000,0,0}
  7.  
  8. uses  Crt,Dos;
  9.  
  10. var   OldInt09h:procedure;
  11.  
  12. Procedure EndTSR; assembler;
  13. asm
  14.                 cli
  15.                 mov AH,49h
  16.                 mov ES,PrefixSeg
  17.                 push ES
  18.                 mov ES,ES:[2Ch]
  19.                 int 21h
  20.                 pop ES
  21.                 mov AH,49h
  22.                 int 21h
  23.                 sti
  24. end;
  25.  
  26. {$f+}
  27. Procedure NewInt09h; interrupt;
  28. var k:byte; kb_exit:boolean;
  29. begin
  30.  k:=Port[$60];
  31.  kb_exit:=False;
  32.  if k<$80
  33.  then begin
  34.        Sound(5000);
  35.        Delay(1);
  36.        NoSound;
  37.       end
  38.  else if k=$CE                          { $4E or $80 }
  39.       then kb_exit:=True;
  40.  asm pushf end;
  41.  OldInt09h;
  42.  if kb_exit
  43.  then begin
  44.        Sound(440);
  45.        Delay(15);
  46.        NoSound;
  47.        SetIntVec(9,@OldInt09h);
  48.        EndTSR;
  49.       end;
  50. end;
  51. {$f-}
  52.  
  53. begin
  54.  GetIntVec(9,@OldInt09h);
  55.  SetIntVec(9,@NewInt09h);
  56.  Keep(0);
  57. end.
  58. >--- cut here -----------------------------------------------------
  59.  
  60.         When you run this program you get a key-click each time you
  61. press a key but TSR program discharges if you press the big '+' key
  62. (at numeric keyboard).
  63.  
  64.                    Greetings,
  65.                             Luis
  66.  
  67.